package com.hzit.order.service.impl;

import com.alibaba.fastjson2.JSON;
import com.hzit.order.entity.PayLog;
import com.hzit.order.mapper.PayLogMapper;
import com.hzit.order.service.IPayLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.constant.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wf
 * @since 2024-02-27
 */
@Service
public class PayLogServiceImpl extends ServiceImpl<PayLogMapper, PayLog> implements IPayLogService {

	@Autowired
	private StringRedisTemplate redisTemplate;
	//1. 从redis中取得支付日志
	@Override
	public PayLog getPayLogFromRedis(String login) {
		String s = redisTemplate.opsForValue().get(Constants.ORDER_PAY_LOG_PREFIX + login);
		return JSON.parseObject(s,PayLog.class);
	}
}
